//
//  B_MySendActivityVC.m
//  DreamOf
//
//  Created by 薛小刚 on 2018/8/23.
//  Copyright © 2018年 薛小刚. All rights reserved.
//

#import "B_MySendActivityVC.h"
#import "B_JoinActivityHeaderView.h"
#import "B_SendActivityTVC.h"
#import "B_JoinActivityFooterView.h"
#import "B_MyActivityListModel.h"

@interface B_MySendActivityVC ()
@property (nonatomic, strong) BaseTableView * mainView;

@end

@implementation B_MySendActivityVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"发布的活动"];
    self.view = self.mainView;
    [self getData];
}



- (BaseTableView *)mainView {
    if (!_mainView) {
        WeakSelf(weSelf, self);
        _mainView = [[BaseTableView alloc] init];
        [_mainView setTableViewFrameWithTop:5 left:0 right:0 bottom:0];
        [_mainView.tableView registerNib:[UINib nibWithNibName:@"B_SendActivityTVC" bundle:nil] forCellReuseIdentifier:@"B_SendActivityTVC"];
        /// 组数
        _mainView.numberOfSectionsBlock = ^NSInteger(UITableView *tableView) {
            return 2;
        };
        /// 组里的个数
        _mainView.numberOfRowsBlock = ^NSInteger(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                return 0;
            }
            return 10;
        };
        _mainView.heightForHeaderBlock = ^CGFloat(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                return 105;
            }
            return 0.1;
        };
        _mainView.viewForHeaderBlock = ^UIView *(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                B_JoinActivityHeaderView * view = [B_JoinActivityHeaderView initB_JoinActivityHeaderView];
                view.B_activityImageView.backgroundColor = [UIColor redColor];
                view.B_activityTitle.text = @"相约周末, 美食小吃才艺展示活动";
                view.B_activityTimeLabel.text = @"2018-09-10";
                view.B_activityStatusLabel.text = @"进行中";
                
                return view;
            }
            return nil;
        };
        _mainView.heightForFooterBlock = ^CGFloat(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                return 44;
            }
            return 0.1;
        };
        _mainView.viewForFooterBlock = ^UIView *(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                B_JoinActivityFooterView * footer = [B_JoinActivityFooterView initB_JoinActivityFooterView];
                footer.B_titleLabel.text = @"已报名: 30";
                return footer;
            }
            UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
            view.backgroundColor = [UIColor color_main_background_color];
            return view;
        };
        _mainView.heightForRowBlock = ^CGFloat(UITableView *tableView, NSIndexPath *indexPath) {
            return 75;
        };
        _mainView.cellForRowBlock = ^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath) {
            ///TODO:在这里取模型赋值
            
            B_SendActivityTVC * cell = [tableView dequeueReusableCellWithIdentifier:@"B_SendActivityTVC" forIndexPath:indexPath];
            cell.B_userName.text = @"易小川";
            cell.B_userImageView.backgroundColor = [UIColor color_text_white];
            cell.B_userPhone.text = @"188 8888 8888";
            return cell;
        };
        _mainView.didSelectRow = ^(UITableView *tableView, NSIndexPath *indexPath) {
            
           
        };
        
    }
    return _mainView;
    
}

- (void) getData{
     
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
